package com.ruoyi.bigScreen;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.domain.zzw.TPeopleLinkEvent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ITPeopleLinkEventService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 重点人和事件关联
Controller
 * 
 * @author ruoyi
 * @date 2023-11-15
 */
@RestController
@RequestMapping("/event")
@Api(tags = "重点人和事件关联控制层")
public class TPeopleLinkEventController extends BaseController
{
    @Autowired
    private ITPeopleLinkEventService tPeopleLinkEventService;

    /**
     * 查询重点人和事件关联列表
     */
    @PreAuthorize("@ss.hasPermi('system:event:list')")
    @GetMapping("/list")
    @ApiOperation("查询重点人和事件关联列表")
    public TableDataInfo list(TPeopleLinkEvent tPeopleLinkEvent)
    {
        startPage();
        List<TPeopleLinkEvent> list = tPeopleLinkEventService.selectTPeopleLinkEventList(tPeopleLinkEvent);
        return getDataTable(list);
    }


    /**
     * 获取重点人和事件关联详细信息
     */
    @ApiOperation("获取重点人和事件关联详细信息")
    @PreAuthorize("@ss.hasPermi('system:event:query')")
    @GetMapping(value = "/{cPeopleId}")
    public AjaxResult getInfo(@PathVariable("cPeopleId") Long cPeopleId)
    {
        return success(tPeopleLinkEventService.selectTPeopleLinkEventByCPeopleId(cPeopleId));
    }

    /**
     * 新增重点人和事件关联
     */
    @ApiOperation("新增重点人和事件关联")
    @PreAuthorize("@ss.hasPermi('system:event:add')")
    @Log(title = "重点人和事件关联 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TPeopleLinkEvent tPeopleLinkEvent)
    {
        return toAjax(tPeopleLinkEventService.insertTPeopleLinkEvent(tPeopleLinkEvent));
    }

    /**
     * 修改重点人和事件关联

     */
    @ApiOperation("修改重点人和事件关联")
    @PreAuthorize("@ss.hasPermi('system:event:edit')")
    @Log(title = "重点人和事件关联 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TPeopleLinkEvent tPeopleLinkEvent)
    {
        return toAjax(tPeopleLinkEventService.updateTPeopleLinkEvent(tPeopleLinkEvent));
    }

    /**
     * 删除重点人和事件关联

     */
    @ApiOperation("删除重点人和事件关联")
    @PreAuthorize("@ss.hasPermi('system:event:remove')")
    @Log(title = "重点人和事件关联 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{cPeopleIds}")
    public AjaxResult remove(@PathVariable Long[] cPeopleIds)
    {
        return toAjax(tPeopleLinkEventService.deleteTPeopleLinkEventByCPeopleIds(cPeopleIds));
    }
}
